package com.itsm.xkitsm.liferoot.life;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;

import com.itsm.xkitsm.liferoot.R;
import com.itsm.xkitsm.liferoot.ems.BaseContorl;

import java.util.HashMap;
import java.util.Map;

/**
 * webURL展示
 * Created by xiaokewang on 2017/9/13.
 */

public class WebShowAct extends Activity implements View.OnClickListener {

    private WebView web_view;
    private ImageView img_express;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.web_layout);
        initView();
        initData();
    }

    private void initView() {
        web_view=findViewById(R.id.wb);
        img_express=findViewById(R.id.img_express);
        img_express.setOnClickListener(this);
    }
    //填充数据
    private void initData() {
       String url= getIntent().getStringExtra("url");
        WebSettings webSettings = web_view.getSettings();
        webSettings.setUseWideViewPort(true);// 设置此属性，可任意比例缩放
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setJavaScriptEnabled(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setSupportZoom(true);
        webSettings.setDomStorageEnabled(true);
        webSettings.setDisplayZoomControls(false);
        web_view.loadUrl(url);
        web_view.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView view,final String url) {

                    view.loadUrl(url);
                return true;
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                BaseContorl.doDimssProgressDialog();

            }
        });
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.img_express:
                finish();
                break;
        }
    }
}
